package org.mikeliu.exp2.exp5;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;

class PersonOverride
{
	private String name;
	private int age;
	private boolean gender;
	public PersonOverride(String name, int age, boolean gender)
	{
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	public PersonOverride()
	{
		this("default", 1, true);
	}
	@Override
	public String toString()
	{
		return name+"-"+age+"-"+gender;
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonOverride other = (PersonOverride) obj;
		return age == other.age && gender == other.gender && Objects.equals(name, other.name);
	}
}

public class Exp5 
{
	public static void main(String[] args)
	{
		int n1,n2;
		Scanner scanner=new Scanner(System.in);
		n1=scanner.nextInt();
		ArrayList<PersonOverride> persons1=new ArrayList<PersonOverride>();
		for(int i=0;i<n1;i++)
		{
			persons1.add(new PersonOverride());
		}
		n2=scanner.nextInt();
		ArrayList<PersonOverride> persons2=new ArrayList<PersonOverride>();
		for(int i=0;i<n2;i++)
		{
			String name=scanner.next();
			int age=scanner.nextInt();
			boolean gender=scanner.nextBoolean();
			PersonOverride personOverride=new PersonOverride(name,age,gender);
			if(!persons2.contains(personOverride))
			{
				persons2.add(personOverride);
			}
		}
		for(int i=0;i<persons1.size();i++)
		{
			System.out.println(persons1.get(i));
		}
		for(int i=0;i<persons2.size();i++)
		{
			System.out.println(persons2.get(i));
		}
		System.out.println(persons2.size());
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
		scanner.close();
	}
}
